import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yt_devops/pages/devices/device_list/device_list_view.dart';
import 'package:yt_devops/pages/home_site_statistics/home_site_statistics_view.dart';
import 'package:yt_devops/pages/mine/mine/mine_view.dart';
import 'package:yt_devops/pages/site/site_setting/siet_elec_price_setting/site_mains_elec_detail/keep_aliver_wrapper.dart';
import 'package:yt_devops/pages/site/site_view.dart';
import 'package:yt_devops/pages/tabs/bottom_bar.dart';
import 'package:yt_devops/resources/resources.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'package:yt_devops/routers/routers.dart';
import 'owener_home_controller.dart';

class OwenerHomePage extends GetView<OwenerHomeController> {
  const OwenerHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<OwenerHomeController>(
      builder: (controller) => Scaffold(
        body: TabBarView(
          controller: controller.tabController,
          physics: const NeverScrollableScrollPhysics(), //禁止滑动
          children: [
            KeepAliveWrapper(HomeSiteStatisticsPage(controller.homeTabviewChildren)),
            KeepAliveWrapper(DeviceListPage()),
            KeepAliveWrapper(MinePage()),
          ],
        ),
        bottomNavigationBar: BottomBars(
          index: controller.selectedIndex,
          onTap: controller.onItemTapped,
          barImages: [
            BarItemImage(
              label: ResKey.home.tr,
              imageUrl: ImageAssets.siteUnselected,
              activeImageUrl: ImageAssets.siteSelected,
            ),
            BarItemImage(
              label: ResKey.device.tr,
              imageUrl: ImageAssets.deviceUnselected,
              activeImageUrl: ImageAssets.deviceSelected,
            ),
            BarItemImage(
              label: ResKey.mine.tr,
              imageUrl: ImageAssets.meUnselected,
              activeImageUrl: ImageAssets.meSelected,
            ),
          ],
        ),
      ),
    );
  }
}
